package com.yangrd.airship.generator.config;

import com.yangrd.airship.generator.support.PageGeneratorDefineMetaHook;
import com.yangrd.airship.generator.support.impl.BasePgdMetaHook;
import com.yangrd.airship.generator.support.impl.CompositePgdMetaHook;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

import java.util.List;

/**
 * @author yangrd
 * @date 2021/11/9
 */
@Configuration
public class PageGeneratorDefineMetaHookConfig {

    @Bean
    public PageGeneratorDefineMetaHook basePgdMetaHook(PageGeneratorProperties properties){
        return new BasePgdMetaHook(properties.getBasePackage());
    }

    @Bean
    @Primary
    public PageGeneratorDefineMetaHook tableGeneratorDefineMetaHook(List<PageGeneratorDefineMetaHook> pageGeneratorDefineMetaHooks){
        return new CompositePgdMetaHook(pageGeneratorDefineMetaHooks);
    }
}
